package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

//启动在启动器加入Mapperscan
public interface EmployeeMapper {
    //员工登录
    @Select("select * from employee where username =#{username}")
    Employee login(Employee employee);

    //添加员工信息
    @Insert("insert into employee values (null,#{name},#{username},#{password},#{phone},#{sex},#{idNumber}," +
            "status,#{createTime},#{updateTime},#{createUser},#{updateUser})")
    Integer save(Employee employee);

    //分页查询
    List<Employee> findByName(@Param("name") String name);

    //修改员工信息
    Integer update(Employee employee);

    //根据id查询员工信息
    @Select("select * from employee where id=#{id} ")
    Employee selectById(Long id);
}
